-
Notifications
You must be signed in to change notification settings - Fork 3
feat: dont delete pages with jira tasks #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@samhotep After running the project and accessing localhost:8104/app in the browser, I get this error $ ./entrypoint 0.0.0.0:${PORT}
$ watch -p 'static/client/**/*.{js,jsx,ts,tsx,scss}' -c 'yarn run build'
* Tip: There are .env files present. Install python-dotenv to use them.
Watching started
INFO [webapp] Connecting to Redis cache.
INFO [googleapiclient.discovery_cache] file_cache is only supported with oauth2client<4.0.0
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
[2025-06-19 15:43:37 +0000] [173] [INFO] Starting gunicorn 23.0.0
[2025-06-19 15:43:37 +0000] [173] [INFO] Listening at: http://0.0.0.0:8104 (173)
[2025-06-19 15:43:37 +0000] [173] [INFO] Using worker: sync
[2025-06-19 15:43:37 +0000] [174] [INFO] Booting worker with pid: 174
[2025-06-19 15:43:37 +0000] [175] [INFO] Booting worker with pid: 175
INFO [webapp] Connecting to Redis cache.
INFO [webapp] Connecting to Redis cache.
INFO [googleapiclient.discovery_cache] file_cache is only supported with oauth2client<4.0.0
INFO [googleapiclient.discovery_cache] file_cache is only supported with oauth2client<4.0.0
Traceback (most recent call last):
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/flask/app.py", line 1514, in wsgi_app
response = self.handle_exception(e)
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/flask_cors/extension.py", line 194, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/flask/app.py", line 1511, in wsgi_app
response = self.full_dispatch_request()
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/flask/app.py", line 919, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/flask_cors/extension.py", line 194, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/flask/app.py", line 915, in full_dispatch_request
rv = self.preprocess_request()
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/flask/app.py", line 1291, in preprocess_request
rv = self.ensure_sync(before_func)()
File "/home/ubuntu/cs-canonical-com/webapp/models.py", line 216, in create_default_project
get_or_create(db.session, Project, name="Default")
File "/home/ubuntu/cs-canonical-com/webapp/models.py", line 49, in get_or_create
instance = session.query(model).filter_by(**kwargs).first()
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/scoping.py", line 1680, in query
return self._proxied.query(*entities, **kwargs)
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2955, in query
return self._query_cls(entities, self, **kwargs)
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 276, in __init__
self._set_entities(entities)
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 288, in _set_entities
self._raw_columns = [
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 289, in <listcomp>
coercions.expect(
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 388, in expect
insp._post_inspect
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 1338, in __get__
obj.__dict__[self.__name__] = result = self.fget(obj)
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/mapper.py", line 2724, in _post_inspect
self._check_configure()
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/mapper.py", line 2401, in _check_configure
_configure_registries({self.registry}, cascade=True)
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/mapper.py", line 4214, in _configure_registries
_do_configure_registries(registries, cascade)
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/mapper.py", line 4255, in _do_configure_registries
mapper._post_configure_properties()
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/mapper.py", line 2418, in _post_configure_properties
prop.init()
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/interfaces.py", line 589, in init
self.do_init()
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/relationships.py", line 1661, in do_init
self._generate_backref()
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/relationships.py", line 2145, in _generate_backref
self._add_reverse_property(self.back_populates)
File "/home/ubuntu/cs-canonical-com/.venv/lib/python3.10/site-packages/sqlalchemy/orm/relationships.py", line 1594, in _add_reverse_property
raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: back_populates on relationship 'JiraTask.webpages' refers to attribute 'Webpage.jira_tasks' that is not a relationship. The back_populates parameter should refer to the name of a relationship on the target class. |
|
@samhotep, webpages are not displaying their jira tasks. |
AttributeError: 'Webpage' object has no attribute 'jira_tasks'
INFO [webapp.scheduled_tasks] Loading site tree for jp.ubuntu.com
INFO [webapp] Connecting to Redis cache.
INFO [webapp] Existing tree {'name': '', 'title': None, 'description': None, 'link': None, 'children': []}
ERROR [webapp.scheduled_tasks] 'Webpage' object has no attribute 'jira_tasks'
Traceback (most recent call last):
File "/home/ubuntu/cs-canonical-com/webapp/scheduled_tasks.py", line 40, in load_site_trees
site_repository.get_tree(no_cache=True)
File "/home/ubuntu/cs-canonical-com/webapp/site_repository.py", line 278, in get_tree
return self.get_new_tree()
File "/home/ubuntu/cs-canonical-com/webapp/site_repository.py", line 212, in get_new_tree
tree = self.create_webpages_for_tree(self.db, base_tree)
File "/home/ubuntu/cs-canonical-com/webapp/site_repository.py", line 378, in create_webpages_for_tree
webpage_dict = self.__create_webpage_for_node__(
File "/home/ubuntu/cs-canonical-com/webapp/site_repository.py", line 315, in __create_webpage_for_node__
webpage_dict = convert_webpage_to_dict(webpage, owner, project)
File "/home/ubuntu/cs-canonical-com/webapp/helper.py", line 96, in convert_webpage_to_dict
webpage.jira_tasks
AttributeError: 'Webpage' object has no attribute 'jira_tasks' |
7c6ac42 to
839f1e5
Compare
|
@muhammad-ali-pk I've updated the PR to not delete webpages on schedule. Instead, when a request is made, we filter all pages with the In the future, we should create a page (and endpoint) for viewing these 'archived' pages. |
2e37a3e to
c9b422c
Compare
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |



Problem Statement
The scheduled task to update webpages is breaking because there's an IntegrityError when deleting a webpage with an existing jira task.
The solution below avoids any deletion, and instead filters these pages from the requests for a tree. In the future, an endpoint can be added to specifically query pages which have been marked
TO_DELETE(archived).Done
TO_DELETEQA
Fixes